from tools.funciton import read_json_file, write_json_file
import os
from config.configs import DATA_PATH
import time


def remove_merchant_skus():
    codes = [
        "113028",
        "129379",
        "165781",
        "171883",
        "225221",
        "226939",
        "256695",
        "321535",
        "399853",
        "433879",
        "525377",
        "539106",
        "545751",
        "583251",
        "615436",
        "616122",
        "620131",
        "679542",
        "754804",
        "774041",
        "799403",
        "885582",
        "900821",
        "919199",
        "930829",
        "938388",
        "964599",
        "997215"
    ]
    res = read_json_file(os.path.join(DATA_PATH, 'apple_watch.json'))
    li = []
    for i in range(len(codes)):
        for z in range(len(res)):
            param = {
                "merchantCode": codes[i],
                "skuId": int(res[z]['skuId']['$numberLong']),
                "status": 0,
                "createdAt": int(round(time.time() * 1000)),
                "updatedAt": int(round(time.time() * 1000)),
                "__v": 0
            }
            li.append(param)
    write_json_file(os.path.join(DATA_PATH, '1.json'), li)


remove_merchant_skus()
